<?php

function smarty_block_checkAdminPerms($params, $content, &$smarty){
    $USER=JFX::registry('JFX_User');

    if(empty($params['module'])){
        $smarty->trigger_error('assign: missing "module" parameter');
        return;
    }

    if(empty($params['label'])){
        $smarty->trigger_error('assign: missing "label" parameter');
        return;
    }

    if(!empty($params['workspace'])){
        $workspaceid = $params['workspace'];
    }else{
        $workspaceid = $USER->workspace;
    }

    if($USER->checkAdminPermission($params['module'], $params['label'], $workspaceid)){
        if(isset($content)){
            return $content;
        }else{
            return;
        }
    }else{
        return;
    }

}
